﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Istantiate : MonoBehaviour {

    public GameObject[] prefabs;
    public int time;
    private GameObject[] hidePrefabs;
    private GameObject info;
    private GameObject other;

	// Use this for initialization
	void Start () {
        StartCoroutine(InstantiatePrefabs());
        info = prefabs[0].GetComponent<Peter_InteractiveObj>().information;
        other = prefabs[1].GetComponent<Peter_InteractiveObj>().otherObj;
    }
	
	// Update is called once per frame
	void Update () {
		
	}

    IEnumerator InstantiatePrefabs()
    {
        yield return new WaitForSeconds(time);
        Instantiate(prefabs[0]);
        Instantiate(prefabs[1]);
        //hidePrefabs[0] = prefabs[0];
        //hidePrefabs[1] = prefabs[1];
        //StartCoroutine(HidePrefabs());
    }

    //IEnumerator HidePrefabs()
    //{
    //    yield return new WaitForSeconds(1);
    //    hidePrefabs[0].SetActive(false);
    //    hidePrefabs[1].SetActive(false);
    //}
}
